/**
 * @description 传入类型名称 获取下拉列表
 */

export const getIntDictOptions = (dictType) => {
    const dictOptions = [];
    let DATA = JSON.parse(sessionStorage.getItem("dictDataJson"));
    DATA && DATA[dictType] && DATA[dictType].forEach(item => {
        dictOptions.push({
            label: item.label,
            value: item.value,
            color:item.colorType
        })
    })

    return dictOptions;
}

/**@description 获取字典label值 */
export const getDictOptions = (dictType) => {

    let list = getIntDictOptions(dictType);
    let dictObject = {};
    list.forEach(item => {
        dictObject[item.value] = { ...item };
    })
    return dictObject;
}

export const DICT_TYPE = {
    COMMON_STATUS: 'common_status',
    SYSTEM_MENU_TYPE: "system_menu_type",
    SYSTEM_DICT_COLORTYPE: "system_dict_colorType",
    PRODUCT_BRAND_STATUS:"product_brand_status",
    PAY_METHODS:"pay_methods",
    SYSTEM_MENU_STATUS:"system_menu_status",
    YES_OR_NO:"yes_or_no"
}